package com.turing.draw.service;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.service.IService;
import com.turing.draw.model.domain.DrawTask;
import com.turing.draw.model.domain.FileTask;
import com.turing.draw.vo.in.TextSearchVO;
import com.turing.draw.vo.out.FileTaskVo;
import com.turing.draw.vo.out.ParaInfoVO;

import java.util.List;


/**
 * @Description $!{table.comment} 服务类接口
 * @Author livin
 * @Date 2021-11-04
 */
public interface FileTaskService extends IService<FileTask> {

    Integer getTaskStatusById( String taskSn );

    void createFileTask(String templateId,DrawTask drawTask, String filePath);

    String queryParentTask(String childTaskSn);

    Integer getTaskVersion(String parentTaskSn);

    List<FileTask> getChildTasks(String taskSn);

    List<ParaInfoVO> initParaInfo(TextSearchVO textSearchVO, FileTask task);

    FileTask getOvertimeTaskByStatus(Integer status );

    FileTask getOvertimeForecastTaskByStatus(Integer status);

    FileTask getFileTaskByStatus(Integer status);

    FileTask getAnalysisTask();

    boolean lockPreProcessorTask( String domain,  String taskSn );

    List<FileTask> getTasksByParentTaskSn( String parentTaskSn );

    boolean updateTaskByStatusAndId(String taskSn,Integer status);

    boolean analysisFinished( String taskSn, String jsonUrl );

    String getParentTaskSn( String taskSn );

    boolean allFileTasksFailed(String parentTaskSn);

    Integer countFilesByParentTaskSnAndStatus(String parentTaskSn,Integer status);

    boolean saveJSONTextByTaskSn( String taskSn,String jsonUrl,String ocrJsonUrl,String cleanTextUrl,String tableJsonUrl );

    boolean finishReview(String taskSn);

    boolean lockForecastTask(String domain, String taskSn);

    boolean unLockForecastTask(String taskSn);

    boolean lockAnalysisTask(String domain, String taskSn);

    boolean unLockAnalysisTask(String taskSn);

    String uploadMergedOcrResult(String taskSn, JSONArray mergedJsonArray,  FileImageService fileImageService);

    boolean savePdfUrl(String pdfUrl, String taskSn);

    boolean tasksFailed(String parentTaskSn,String errorMessage);

    boolean forecastFinished(String parentTaskSn);

    boolean ocrFinished(String parentTaskSn);

    boolean saveTotalPage(String taskSn,Integer totalPage);

    boolean doRuleProcess(FileTask task);

    FileTask getForecastTask(String templates);

    FileTask getCurriculumVitaeTask();

    FileTask getTaskByTaskSn(String taskSn);

    List<FileTask> getSonTaskByParentFileTaskSn(String parentFileTaskSn);

    boolean updateTaskTemplateIdById(String taskSn,String templateId);



    /**
     * 根据draw_task_sn获取模板id列表
     *
     * @param drawTaskSn draw_sn
     * @return {@link List}<{@link FileTaskVo}>
     */
    List<FileTaskVo> getTemplateIdListByDrawTaskSn(String drawTaskSn);
}
